//
//  ReturnViewController.m
//  EveryDesigner
//
//  Created by CJX on 16/8/30.
//  Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved.
//

#import "ReturnViewController.h"

@interface ReturnViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,copy) NSString * str;

@end

@implementation ReturnViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self makeNaviButton];
    
    [self makeView];
    
    
}

-(void)makeView{
    _str = @"Return Policy\n\nThanks for shopping at our app.\n\n1)If you are not 100% satisfied with your purchase, you can return the product and get a full refund or exchange the product for another one,be it similar or not.\n\n2)You can return a product for up to 30 days from the date you purchased it.\n\n3)Any product you return must be in the same condition you received it.Please keep the order number,you should contact us before you return the product.\n\nRefunds\n\nOnce we receive your item,we will inspect it and notify you that we have received your returned item.We will immediately notify you on the status of your refund after inspecting the item.\n\nIf your return is approved,we will initiate a refund to your credit card(or original method of payment).\n\nYou will receive the credit within a certain amount of days,depending on your card issuer’s policies.\n\nShipping\n\nYou will be responsible for paying for your own shipping costs for returning your item.\n\nShipping costs are non-refundable.If you receive a refund,the cost of return shipping will be deducted from your refund.\n\nContact Us \nIf you have any questions on how to return your item to us,contact us.\n\n  ";
    
    self.view.backgroundColor=[UIColor whiteColor];

    
    
    UITableView * tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
    tableView.delegate = self;
    tableView.dataSource = self;
    
    [self.view addSubview:tableView];
    
    
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        
//        cell.textLabel.text = _str;
//        cell.textLabel.numberOfLines = 0;
//        
        
        
    }
    UILabel *contactLabel=[[UILabel alloc]init];
    contactLabel.text=_str;
    
    contactLabel.font = [UIFont systemFontOfSize:12];
    contactLabel.numberOfLines=0;
    [cell addSubview:contactLabel];
    if (KScreenWidth == 320) {
        contactLabel.frame = CGRectMake(20, 5, KScreenWidth-40, 568 + 250);
    }else if(KScreenWidth >320&& KScreenWidth < 400){
        contactLabel.frame = CGRectMake(20, 0, KScreenWidth-40, KScreenHeight+105);
    }
    else{
        contactLabel.frame = CGRectMake(20, 0, KScreenWidth-40, KScreenHeight+20);
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (KScreenWidth == 320) {
        return 568 + 180;
    }else if(KScreenWidth >320&& KScreenWidth < 400){
        return KScreenHeight + 10;
    }else{
        return KScreenHeight ;
    }
    
}

-(void)makeNaviButton{
    
    self.title=@"RETURN POLICY";
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [leftButton setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:0];
    
    leftButton.frame=CGRectMake(0, 0, ACTUAL_WIDTH(23), ACTUAL_HEIGHT(23));
    
    [leftButton addTarget:self action:@selector(comeBack) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem*item= [[UIBarButtonItem alloc]initWithCustomView:leftButton];
    
    self.navigationItem.leftBarButtonItem=item;
}
#pragma mark 返回事件
-(void)comeBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
